extends Control

@onready var my_sprite = get_parent()
@onready var health_bar: ProgressBar = %HealthBar
@onready var anger_bar_1: ProgressBar = %AngerBar1
@onready var anger_bar_2: ProgressBar = %AngerBar2
@onready var anger_bar_3: ProgressBar = %AngerBar3
@onready var anger_bar_4: ProgressBar = %AngerBar4

func _ready() -> void:
	health_bar.max_value = my_sprite.health
	anger_bar_1.value = 0
	anger_bar_2.value = 0
	anger_bar_3.value = 0
	anger_bar_4.value = 0
	
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
	health_bar.value = my_sprite.health
	match my_sprite.anger:
		0:
			anger_bar_1.value = 0
			anger_bar_2.value = 0
			anger_bar_3.value = 0
			anger_bar_4.value = 0
		1:
			anger_bar_1.value = 100
			anger_bar_2.value = 0
			anger_bar_3.value = 0
			anger_bar_4.value = 0
		2:
			anger_bar_1.value = 100
			anger_bar_2.value = 100
			anger_bar_3.value = 0
			anger_bar_4.value = 0
		3:
			anger_bar_1.value = 100
			anger_bar_2.value = 100
			anger_bar_3.value = 100
			anger_bar_4.value = 0
		4:
			anger_bar_1.value = 100
			anger_bar_2.value = 100
			anger_bar_3.value = 100
			anger_bar_4.value = 100
			
